package com.company;

public class Main {

    static int a(int r[],int low,int high,int key)
    {
        int mid;
        while (low<=high)
        {
            mid = (low+high)/2;
            if (r[mid]==key)
            {
                return mid;
            }else if (key<r[mid])
            {
                return a(r,low,mid-1,key);
            }else
                return a(r,mid+1,high,key);
        }
        return -1;
    }


    public static void main(String[] args) {
           int arr[]={1,23,34,54,100};
           int c = a(arr,0,arr.length-1,100);
        System.out.println(c);
    }


}
